package cn.zhf.shop.service.impl;

import cn.zhf.shop.entity.Message;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import cn.zhf.shop.mapper.BankcardMapper;
import cn.zhf.shop.entity.Bankcard;
import cn.zhf.shop.service.BankcardService;

import java.util.List;

@Service
public class BankcardServiceImpl implements BankcardService{

    @Resource
    private BankcardMapper bankcardMapper;

    @Override
    public Message deleteByPrimaryKey(Integer id) {
        return bankcardMapper.deleteByPrimaryKey(id)> 0 ? Message.success(null) : Message.fail(null);
    }

    @Override
    public Message insert(Bankcard record) {
        return bankcardMapper.insert(record)> 0 ? Message.success(null) : Message.fail(null);
    }

    @Override
    public Message insertSelective(Bankcard record) {
        return bankcardMapper.insertSelective(record)> 0 ? Message.success(null) : Message.fail(null);
    }

    @Override
    public Message<Bankcard> selectByPrimaryKey(Integer id) {
        return Message.success(null).add(bankcardMapper.selectByPrimaryKey(id));
    }

    @Override
    public Message updateByPrimaryKeySelective(Bankcard record) {
        return bankcardMapper.updateByPrimaryKeySelective(record)> 0 ? Message.success(null) : Message.fail(null);
    }

    @Override
    public Message updateByPrimaryKey(Bankcard record) {
        return bankcardMapper.updateByPrimaryKey(record)> 0 ? Message.success(null) : Message.fail(null);
    }

    @Override
    public Message<List<Bankcard>> selectAllByClassUserId(String classUserId) {
        return Message.success(null).add(bankcardMapper.selectAllByClassUserId(classUserId));
    }

}
